package com.xiaoxi.xirpc.registry;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 *  本地注册中心
 */
public class LocalRegistry {

    /**
     *  注册信息存储
     */
    private static final Map<String, Class<?>> map = new ConcurrentHashMap<>();

    public static void registry(String serviceName, Class<?> implClass){
        map.put(serviceName, implClass);
    }

    /**
     *  获取服务
     * @param serviceName
     * @return
     */
    public static Class<?> get(String serviceName){
        return map.get(serviceName);
    }

    /**
     *  删除服务
     * @param serviceName
     */
    public static void remove(String serviceName){
        map.remove(serviceName);
    }

}
